package template

import (
	"github.com/gogf/gf/v2/frame/g"
	commonApi "{{package_info.commonApi}}"
	model "{{package_info.model}}"

)

type {{table_info.firstUpperName}}AddReq struct {
	g.Meta `path:"/{{table_info.camelName}}/add" method:"post" tags:"{{table_info.comment}}" summary:"{{table_info.comment}}-新增"`
	{% for item in field_info %}
	{% if item.camelName not in ['id','createdBy','updatedBy','createdAt','updatedAt'] %}
    {{ item.firstUpperName }} {{ item.type }} `json:"{{ item.camelName }}" v:"required#{{ item.comment }}不能为空"`
    {% endif %}
    {% endfor %}
}

type {{table_info.firstUpperName}}AddRes struct {
	g.Meta `mime:"application/json" example:"string"`
}

type {{table_info.firstUpperName}}DelReq struct {
	g.Meta `path:"/{{table_info.camelName}}/del" method:"delete" tags:"{{table_info.comment}}" summary:"{{table_info.comment}}-删除"`
	Id uint `json:"id" v:"required#id不能为空"`
}

type {{table_info.firstUpperName}}DelRes struct {
	g.Meta `mime:"application/json" example:"string"`
}

type {{table_info.firstUpperName}}BatchDelReq struct {
	g.Meta `path:"/{{table_info.camelName}}/batchdel" method:"delete" tags:"{{table_info.comment}}" summary:"{{table_info.comment}}-批量删除"`
	Ids []uint `json:"id" v:"required#id不能为空"`
}

type {{table_info.firstUpperName}}BatchDelRes struct {
	g.Meta `mime:"application/json" example:"string"`
}

type {{table_info.firstUpperName}}EditReq struct {
	g.Meta `path:"/{{table_info.camelName}}/edit" method:"put" tags:"{{table_info.comment}}" summary:"{{table_info.comment}}-修改"`
	{% for item in field_info %}
	{% if item.camelName not in ['createdBy','updatedBy','createdAt','updatedAt'] %}
    {{ item.firstUpperName }} {{ item.type }} `json:"{{ item.camelName }}" v:"required#{{ item.comment }}不能为空"`
    {% endif %}
    {% endfor %}
}

type {{table_info.firstUpperName}}EditRes struct {
	g.Meta `mime:"application/json" example:"string"`
}

type {{table_info.firstUpperName}}ListReq struct {
	g.Meta `path:"/{{table_info.camelName}}/list" method:"get" tags:"{{table_info.comment}}" summary:"{{table_info.comment}}-列表"`
	commonApi.PageReq
    {% for item in field_info %}
    {% if item.camelName not in ['id','createdBy','updatedBy','createdAt','updatedAt'] %}
    {{ item.firstUpperName }} {{ item.type }} `json:"{{ item.camelName }}" v:"required#{{ item.comment }}不能为空"`
    {% endif %}
    {% endfor %}
}

type {{table_info.firstUpperName}}ListRes struct {
	g.Meta `mime:"application/json" example:"string"`
	commonApi.ListRes
	{{table_info.firstUpperName}}List []*model.{{table_info.firstUpperName}}Info `json:"{{table_info.camelName}}List"`
}

type {{table_info.firstUpperName}}DetailReq struct {
    g.Meta `path:"/{{table_info.camelName}}/detail" method:"get" tags:"{{table_info.comment}}" summary:"{{table_info.comment}}-详情"`
    Id uint `json:"id" v:"required#id不能为空"`
}

type {{table_info.firstUpperName}}DetailRes struct {
	g.Meta `mime:"application/json" example:"string"`
	*model.{{table_info.firstUpperName}}Info
}